#ifndef QQ_FRIEND_PAGE
#define QQ_FRIEND_PAGE

#include <qlayout.h>
#include <qstandarditemmodel.h>

#include <ElaIconButton.h>
#include <ElaLineEdit.h>
#include <ElaListView.h>
#include <ElaText.h>
#include <ElaTabWidget.h>
#include <ElaMenu.h>
#include <ElaScrollPage.h>
#include <ElaWidget.h>

#include "core/QQConfig.h"
#include "friend/QQFriendIndexDelegate.h"
#include "friend/QQFriendRequestDelegate.h"

class QQFriendPage : public ElaScrollPage
{
	Q_OBJECT

public:
	QQFriendPage(QWidget* parent = nullptr);
	~QQFriendPage();
	void add_friend(const QQFriendIndexItem& _friend);
	void show_add_friend_dialog();
	void add_add_friend_request_item(const QString& _friend);
	void load_friends(const QList<QQFriendIndexItem>& _friends);
signals:
	void add_friend_click(const QString& account);
	void add_friend_request_click(const QString& account, int type);
	void remove_friend_click(const QString& account);
private slots:
	void do_menu_action(QAction* action);
	void do_add_friend_request(const QModelIndex& index, int type);
private:
	QWidget* m_friend;

	ElaLineEdit* m_search;
	ElaIconButton* m_menu_button;
	ElaMenu* m_menu;
	ElaIconButton* m_notice_button;

	ElaListView* m_friends;
	QQFriendIndexDelegate* m_friends_delegate;
	QStandardItemModel* m_friends_model;

	ElaTabWidget* m_tab;
	ElaListView* m_friend_request;
	QStandardItemModel* m_friend_request_model;
	QQFriendRequestDelegate* m_friend_request_delegate;

};

#endif// !QQ_FRIEND_PAGE